package com.solvePlat.controller;

import com.solvePlat.entity.UserFollow;
import com.solvePlat.entity.base.BaseResponse;
import com.solvePlat.service.Impl.UserFollowServiceImpl;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/userFollow")
public class UserFollowController {

    @Resource
    private UserFollowServiceImpl userFollowService;

    @GetMapping("/followWorkInfo")
    public BaseResponse followWorkInfo(UserFollow userFollow){
        BaseResponse<String> baseResponse = new BaseResponse<String>();
        try{
            userFollowService.followWorkInfo(userFollow);
            baseResponse.setData("");
            baseResponse.setSuccess(true);
            baseResponse.setMsg("关注成功!");
        }catch (Exception e){
            baseResponse.setData("");
            baseResponse.setSuccess(false);
            baseResponse.setMsg("关注失败!");
        }

        return baseResponse;
    }
    @GetMapping("/cancleFollowWorkInfo")
    public BaseResponse cancleFollowWorkInfo(UserFollow userFollow){
        BaseResponse<String> baseResponse = new BaseResponse<String>();
        try{
            userFollowService.cancleFollowWorkInfo(userFollow);
            baseResponse.setData("");
            baseResponse.setSuccess(true);
            baseResponse.setMsg("取消关注!");
        }catch (Exception e){
            baseResponse.setData("");
            baseResponse.setSuccess(false);
            baseResponse.setMsg("取消关注失败!");
        }
        return baseResponse;
    }

}
